assert(PandaDKPMaster, "PandaDKPMaster not found!")

------------------------------
--      Are you local?      --
------------------------------
local PandaDKPMaster = PandaDKPMaster
local Pools =
{
}
PandaDKPMaster.Pools = Pools


function Pools:Enable()
end

function Pools:AddPool(name)
   -- Return if the pool is already in our list
   for index,value in pairs(PandaDKPMaster.db.realm.DKP.Pools) do
      if (value == name) then return end
   end
   
   -- Insert the pool and resort the pools array
   tinsert(PandaDKPMaster.db.realm.DKP.Pools, name)
   sort(PandaDKPMaster.db.realm.DKP.Pools)
   
   -- Update the UI
   PandaDKPMaster.Config:PoolsListUpdate()
   Pools.InterfaceList = nil
end

function Pools:RemovePool(name)
   for index,value in pairs(PandaDKPMaster.db.realm.DKP.Pools) do
      if (value == name) then
         tremove(PandaDKPMaster.db.realm.DKP.Pools, index)
         
         -- Update the UI
         PandaDKPMaster.Config:PoolsListUpdate()
         Pools.InterfaceList = nil
         break
      end
   end
   
end

function Pools:GetInterfaceList()
   if (nil == Pools.InterfaceList) then
      Pools.InterfaceList = {}
      for index,value in pairs(PandaDKPMaster.db.realm.DKP.Pools) do
         Pools.InterfaceList["p"..index] = value
      end
   end
   
   return Pools.InterfaceList
end